begintownscript;

variables;

body;

beginstate INIT_STATE;
break;
beginstate START_STATE;
break;
beginstate EXIT_STATE;
break;

beginstate 10; // entry message
	if (get_flag(1,0)==1) break;
	message_dialog("Cool air and a musty smell waft from the entrance of this cave. As you approach further, however, you also notice traces of a sharp and unpleasant stink.",
			"You can recognize it. Any adventurer learns to within weeks. It's goblin feces. You sigh in anticipation of a short but tedious stint of pest removal.");
	set_flag(1,0,1);
break;

beginstate 11;
	if (in_horse() > -1) 
	{
		print_str_color("Your horses shy away from the dark and foreboding cave entrance.",1);
		block_entry(1);
	} 
break;


beginstate 12; // ambush
	if (get_flag(1,1)==1) break;
	play_sound(-18);
	message_dialog("Now that the dying squeaks of the goblins behind you have faded, the cavern tunnels are completely silent. Almost too silent. For a moment you wonder if those were all there were.",
"Then you see, just in time, a flicker of movement out of the corner of your eyes. You ready your weapons in the same instant as the goblins spring their ambush.");
	activate_hidden_group(1);
	set_flag(1,1,1);
break;

beginstate 13; // room
	if (get_flag(1,3)==1) break;
	message_dialog("Perhaps you underestimated these goblins. They are not only stronger than the cannon fodder you normally encounter, but also seem to take care of their cavern very well. You have yet to see litter lying anywhere.",
		"And the leaders of this tribe have decorated their war room with tattered wall-hangings and a vicious looking boar skull. This weakness for home improvement does not, however, make them want to pass up an opportunity to disembowel you.");
	set_mobility(30,1); // we don't want these critters wandering off 
	set_mobility(31,1); // so they're frozen until this special is called.
	set_mobility(32,1);
	set_mobility(33,1);
	set_flag(1,3,1);
break;

beginstate 14; // discover secret passage
	if (get_flag(1,4)==1) break;
	message_dialog("The surprises don't end at a few wall-hangings. If you hadn't stumbled on this concealed door, you would never have known it was here. The edges are completely invisible to the naked eye. The goblins could never have done this. Or could they?","");
	set_flag(1,4,1);
break;


beginstate 15; // go downstairs
	print_str("You walk down the steeply sloping tunnel.");
	move_to_new_town(2,30,36);
break;

beginstate 16; // discover key
	if (has_special_item(1)==0) 
	{
	message_dialog("Among the assorted valuables that are in this chest, you also find a large brass key. Those usually come in handy elsewhere, so you pocket it.","");
	change_spec_item(1,1);
	}
break;

